#include<iostream>
using namespace std;
#include<cmath>
#include<string.h>
void calculateAre(string s, double a, double b = 0, double c = 0) {
	string s1 = "circle";
	string s2 = "rectangle";
	string s3 = "Triangle";

	if (s1==s) {
		cout << "该图形为：圆形,";
		cout << "其面积为：";
		cout << 3.14 * a * a;
	}
	if (s2==s) {

		cout << "该图形为：矩形,";
		cout << "其面积为：";
		cout << a * b;
	}
	if (s3==s) {
		if (a + b > c && a + c > b && b + c > a) {

			cout << "该图形为：三角形,";
			double s = (a + b + c) / 2;
			cout << "其面积为：";
			cout << sqrt(s * (s - a) * (s - b) * (s - c));
		}
		else cout << "该边长构不成三角形";
	}
}
int main() {
	cout << "请输入要计算的图形类型(1-圆形，2-矩形，3-三角形): ";
	int n;
	cin >> n;
	cout << "请输入“图形”的边长：";//输入三条边长，用到几个就取前几个
	double n1, n2, n3;
	cin >> n1 >> n2 >> n3;
	if (n == 1)calculateAre("circle", n1);
	if (n == 2)calculateAre("rectangle", n1, n2);
	if (n == 3)calculateAre("Triangle", n1, n2, n3);

	return 0;
}
